<template>
  <!-- 公共头 -->
  <header id="header">
    <section class="container">
      <div>
        <ul class="nav">
          <div v-for="(item,index) in tabList" :key="index" @click="changeTab(item.type)" :class="{'current':tab==item.type,'nomal':true}">{{ item.name }}</div>
        </ul>
      </div>
      <div class="clear"></div>
    </section>
  </header>
</template>

<script>
export default {
  name: "AppHeader",
  data() {
    return {
      tab:0,
      tabList:[
        {
          name:'考勤',
          type:0
        },
        // {
        //   name:'其他',
        //   type:1
        // },
        // {
        //   name:'吊毛',
        //   type:2
        // }
      ]
    };
  },
  methods: {
    changeTab(type) {
      this.tab = type
      this.$emit('changeTab',type)
    },
  },
}
</script>

<style scoped>
#header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}
.nav {
    padding: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.current{
  color: #2d8cf0;
  border-bottom: 2px solid #2d8cf0;
}

.nomal{
  margin: 0 20px;
  cursor: pointer;
}
</style>

